package top.healthylife.gateway.platform.br.api.api.basicdata;


import cn.hutool.core.bean.BeanUtil;
import com.alibaba.fastjson.JSON;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import top.healthylife.gateway.core.service.ParentFace;
import top.healthylife.gateway.dto.annotation.ApiServiceExplain;
import top.healthylife.gateway.platform.br.api.utils.GetmeltingTokenUtils;
import top.healthylife.gateway.platform.br.dto.basicdata.paymentbank.req.BrReqPaymentBankDto;
import top.healthylife.gateway.platform.br.dto.basicdata.paymentbank.res.BrResPaymentBankDto;

/**
 * @author cl
 * @version 1.0
 * @date 2020/4/23 9:16
 */
@Slf4j
@Service
@ApiServiceExplain( docUrl="https://account-self.100credit.com/", price = 20,apiName = "支付消费行为偏好信息识别", info = "用户银行卡行为偏好分析-近1、3、6个月（自然月）支付消费统计情况，并返回各模型综合评分")
public class PaymentBankApi implements ParentFace<BrReqPaymentBankDto, BrResPaymentBankDto> {
    /**
     * 接口唯一标识
     */
    static final String APIIDENTIFICATION = "PayBehavior";

    /**
     * 接口版本号
     */
    static final String VESION = null;

    @Override
    public BrResPaymentBankDto execute(BrReqPaymentBankDto brDemoApi){
        //访问百融获取数据
        String apiData = GetmeltingTokenUtils.getApiData(APIIDENTIFICATION, VESION
                , BeanUtil.beanToMap(brDemoApi), GetmeltingTokenUtils.systemConfigInfo(brDemoApi));
        return JSON.parseObject(apiData, BrResPaymentBankDto.class);
    }
}
